using System;
using Microsoft.Build.BuildEngine;
using System.Xml.XPath;

namespace AntEater.Runtime.Services
{
    /// <summary>
    /// Provides general helper methods.
    /// </summary>
    internal static class Utilities
    {
        /// <summary>
        /// Gets the MS build project.
        /// </summary>
        /// <param name="buildFileXml">The build file XML.</param>
        /// <param name="buildFilePath">The build file path.</param>
        /// <param name="buildEnginePath">The build engine path.</param>
        /// <returns></returns>
        public static Project GetMSBuildProject(string buildFileXml, string buildFilePath, string buildEnginePath) {

            Engine buildEngine = new Engine(buildEnginePath);
            Project buildProject = new Project(buildEngine);

            buildProject.FullFileName = buildFilePath;
            buildProject.LoadXml(buildFileXml);

            return buildProject;
        }

    }
}
